#!/bin/sh

### BEGIN INIT INFO
# Provides:          xchengBlog
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: LXC-HTTP-Server.
# Description:       Start or stop the LXC-HTTP-Server.
### END INIT INFO

 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=xchengBlog
INDEX_FILE=start.php
PHP_PATH=/usr/bin/php
PROJECT_PATH=/var/www/fk2/
 
case "$1" in
    start)
        cd $PROJECT_PATH;
        echo "$NAME start"
        $PHP_PATH $INDEX_FILE start
    ;;
 
    stop)
        cd $PROJECT_PATH;
        echo "$NAME stop"
        $PHP_PATH $INDEX_FILE stop
    ;;
 
    status)
        cd $PROJECT_PATH;
        echo "$NAME status"
        $PHP_PATH $INDEX_FILE status
    ;;
 
    restart)
        cd $PROJECT_PATH;
        echo "$NAME restart"
        $PHP_PATH $INDEX_FILE restart
    ;;
 
    *)
        echo "Usage: service $NAME {start|stop|restart|status}"
        exit 1
    ;;
 
esac
